
def fib (n)
  a,b = 0,1
  sum = 0
  n.times do
    if b >= 2
	#printf("%d\n", a)
	sum = sum + a if a%2 == 0
	end
    a,b = b,a+b
  end
  puts sum
end

fib 4000000